<?php
	$dbconn;
	class oc{
		function __construct() {
			$dbuser = 'cs3380sp11grp2';
			$dbpass = 'rHJmBSWL';
			$dbname = 'dbase1';
            // try connecting to the database
			global $dbconn;
			$dbconn = oci_connect($dbuser, $dbpass, $dbname);
			
			// check for any errors
			if (!$dbconn)
			{
				$e = oci_error();
				echo 'I Suck At Life';
				print htmlentities($e['message']);
				exit;
			}
		}
		
		function __destruct(){
			global $dbconn;
			oci_close($dbconn);
			echo 'Database closed <br />';
		}
		
		function fetch($query){
			global $dbconn;
			$results;
			$parsed = oci_parse($dbconn, $query);
			oci_execute($parsed);
			oci_fetch_all($parsed, $results, null, null, OCI_FETCHSTATEMENT_BY_ROW);
			oci_free_statement($parsed);
			var_dump($results);
			return $results;
		}
	}
?>